
const chartMixin = {
	// components: { // 非H5端无法通过mixin注册组件, 只能在main.js中注册全局组件或具体界面中注册
	// 	MescrollUni,
	// 	MescrollBody
	// },
	data() {
		return {
			lvlName:'',
			datePopupShow:false,
			lvlPopupShow:false,
			dateValue:"", 
			// popupShow:false,
			chartWidth:220,
			chartHeight:220,
			pixelRatio:1,
			lvlForm:{
				jxsId:'', //	经销商编码
				jlId:'', //	经理编码
				bbzId:'', //	本部长编码
				lsId:'', //	理事编码
			},
			beginDate:'',
			endDate:'',
			num:0,
			orgLv:uni.getStorageSync('storeOrgLv'),
			colorList:['#ff0000','#00ff00','#0000ff','#ff0000','#00ff00','#0000ff','#ff0000','#00ff00','#0000ff','#ff0000','#00ff00','#0000ff','#ff0000','#00ff00','#0000ff',]
		}
	},
	
	methods: {
		formatRMB(num,unit=''){
			if(unit===''){
				return '￥'+ (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
			}else if(unit==='wan') {
				return num+'万'
			}else{
				return num
			}
			
		},
		changeLvl(name,form){
			console.log("99999changeLvl(name,form",name,form);
			this.lvlName=name
			this.lvlForm = form
			// this.loadChartData()
			// this.mescroll.resetUpScroll()
		},
		doSearchByLvl(){
			console.log("99999doSearchByLvl");
			this.loadChartData()
			this.mescroll.resetUpScroll()
		},
		onSelected(e, key) { //选择
			this.datePopupShow = false;
			if (e&&e.value&&e.value.length===2) {
				let [startTime,endTime] = e.value
				// console.log("e.value ",e.value,startTime,endTime);
				this.beginDate = startTime
				this.endDate = endTime
				this.loadChartData()
				this.mescroll.resetUpScroll()
			}
		},
		determine(data,flag){
			if(flag=='clear'){
				this.beginDate=''
				this.endDate=''
			}else{
				this.beginDate=data[0]
				this.endDate=data[1]
			}
			this.datePopupShow = false;
			this.loadChartData()
			this.mescroll.resetUpScroll()
		},
		
	},
	mounted() {
		
	}
	
}

export default chartMixin;
